[Unit]
Description=NVIDIA DCGM Exporter
After=docker.service
Requires=docker.service

[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull {{ nvidia_dcgm_container }}
ExecStart=/usr/bin/docker run --rm --gpus all --cap-add=SYS_ADMIN --cpus="{{ nvidia_dcgm_max_cpu }}" --name %n -p 9400:9400 -v "{{ nvidia_dcgm_container_config_dir }}/{{ nvidia_dcgm_container_custom_metrics_file }}:/etc/dcgm-exporter/default-counters.csv" {{ nvidia_dcgm_container }}

[Install]
WantedBy=multi-user.target
